import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const state = {
  count: 1,
  user: {
    id: '',
    username: '',
    password: ''
  }
}

const mutations = {
  addUser (state, payload) {
    state.user.id = payload.data.id
    state.user.username = payload.data.username
    state.user.password = payload.data.password
  },
  increment (state, payload) {
    state.count += payload.count
  }
}

export default new Vuex.Store({
  state,
  mutations
})
